<?php

/**
 *
 * @property boolean isNew
 * @property integer id
 */
class Entity extends DomObj
{

  protected $modified = array();

  protected function get_id()
  {
    return $this->_get($this->getModel()->getPk());
  }

  protected function get_isNew()
  {
    return empty($this->data[$this->getModel()->getPk()]);
  }

  protected function _del($name)
  {
    $this->getModel()->fieldExists($name);
    return call_user_func_array(array('parent', '_del'), func_get_args());
  }

  protected function _get($name)
  {
    $this->getModel()->fieldExists($name);
    return call_user_func_array(array('parent', '_get'), func_get_args());
  }

  protected function _has($name)
  {
    $this->getModel()->fieldExists($name);
    return call_user_func_array(array('parent', '_has'), func_get_args());
  }

  protected function _set($name, $value)
  {
    $this->getModel()->fieldExists($name);
    return call_user_func_array(array('parent', '_set'), func_get_args());
  }

  /**
   *
   *
   * @return EntityModel
   */
  public function getModel()
  {
    return Domain::getObject($this->model);
  }

}
